//
//  CFBTTopicTableVVC.m
//  半糖框架
//
//  Created by afro on 15/12/30.
//  Copyright © 2015年 afro. All rights reserved.
//

#import "CFBTTopicTableVC.h"
#import "CFBTTopicTableViewCell.h"

@interface CFBTTopicTableVC ()
{
    UINib * nib;
}
@end

@implementation CFBTTopicTableVC

- (void)setTopicArr:(NSArray *)topicArr {
    
    if (_topicArr == nil) {
        
        _topicArr = [NSArray array];
        
    }
    
    _topicArr = topicArr;
    
    [self.tableView reloadData];
    
}

- (void)viewDidLoad {
    
    [super viewDidLoad];
    self.tableView.showsVerticalScrollIndicator = NO;
}

#pragma mark - Table view data source

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.topicArr.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *cellID = @"topicCell";
    
    if (nib == nil) {
        nib = [UINib nibWithNibName:@"CFBTTopicTableViewCell" bundle:nil];
        [tableView registerNib:nib forCellReuseIdentifier:cellID];
    }
    
    CFBTTopicTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    
    cell.topic = self.topicArr[indexPath.row];
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return 265;
}
@end
